<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
    
        let a = "abc凯哥789";

        let b = a.substring(3,5);  //包含3  不包含5
        console.log(b);  // 凯哥

        let bb = a.substring(5,3);  //没有前后限制，自动调整
        console.log(bb);

        let c = a.substring(3);   //3到最后
        console.log(c);  //凯哥789

        let d = a.substring(-2, 3);   //没有负数
        console.log(d);

        let e = a.slice(-2, -1);   //可以倒着数，并且要满足先后顺序
        console.log(e);

    </script>
</body>
</html>